package cn.wit.summit.chwan.adapters;

import android.app.Activity;

import java.util.List;

import cn.wit.summit.chwan.R;
import cn.wit.summit.chwan.models.dto.ViewBean;
import cn.wit.summit.chwan.widgets.skeleton.SkeletonAdapter;

public class FindFragmentSkeletonAdapter extends SkeletonAdapter {

    //region ViewType
    public static int T_GAME_TYPE = 1;
    public static int T_TITLE     = 2;
    public static int T_GAME_ITEM = 3;
    public static int T_BILLBOARD = 4;
    //endregion

    private final List<ViewBean> datas;

    public FindFragmentSkeletonAdapter(Activity context, List<ViewBean> datas) {
        this.datas = datas;
    }

    @Override
    public int getLayoutResId(int viewType) {
        if (viewType == T_GAME_TYPE) {
            return R.layout.find_fragment_game_type_item_skeleton;
        } else if (viewType == T_TITLE) {
            return R.layout.find_fragment_title_item1_skeleton;
        } else if (viewType == T_GAME_ITEM) {
            return R.layout.find_fragment_game_item_item_skeleton;
        } else if (viewType == T_BILLBOARD) {
            return R.layout.find_fragment_billboard_item_skeleton;
        }
        return super.getLayoutResId(viewType);
    }

    @Override
    public int getItemViewType(int position) {
        if (datas == null) return 0;
        return datas.get(position).getViewType();
    }

    @Override
    public int getItemCount() {
        if (datas == null) return 0;
        return datas.size();
    }
}
